package com.yoo.module_base.utils

import android.app.Activity
import android.content.Intent
import android.net.Uri
import android.widget.Toast

class SendEmailUtils {
    companion object {
        fun sendEmail(context: Activity?, title: String, extraText: String) {
            try {
                val emailIntent = Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:"))/*不带附件发送邮件*/
                if(emailIntent!= null) {
                    emailIntent.putExtra(Intent.EXTRA_SUBJECT, title)
                    emailIntent.putExtra(Intent.EXTRA_EMAIL, arrayOf("contact@Ons.com"))
                    emailIntent.putExtra(Intent.EXTRA_TEXT, extraText) //发送的内容
                    context?.startActivity(emailIntent)
                }
            }catch (e :Exception){
                Toast.makeText(context,"Please set up an email account and send us feedback", Toast.LENGTH_SHORT).show()
            }

        }

    }
}